package com.gzhryc.system.dao;

import java.sql.SQLException;
import java.util.List;

import com.gzhryc.jdbc.BaseDao;
import com.gzhryc.jdbc.Query;
import com.gzhryc.system.dao.db.Role;

public class RoleDao extends BaseDao<Role>{

	public RoleDao(String jdbcKey) {
		super(jdbcKey);
	}

	public List<Role> findByManagerId(Long managerId) throws SQLException{
		String sql = "select t.* from sys_role t"
				+ " inner join sys_manager_role t1 on t1.role_id = t.id"
				+ " where t1.manager_id = ?";
		Query query = new Query(sql);
		query.getParams().setObject(managerId);
		return this.jdbcHelper.find(query, Role.class);
	}
}
